<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"
	import="com.servlet.berichten.*, java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	com.servlet.berichten.MessageContainer messageContainer = new com.servlet.berichten.MessageContainer();
%>
<html>
<body>
	<form method="post" action="">
		Naam:<br /> <input type="text" name="name" /><br /> Bericht:<br />
		<input type="text" name="message" /><br /> <input type="submit"
			value="Bericht plaatsen" />
	</form>
	<br />
	<br />
	<br />
	<%
		String name = request.getParameter("name");
		String message = request.getParameter("message");
		if (name != null && message != null && !name.equals("") && !message.equals("")) {
			messageContainer.addMessage(name, message);
		}

		ArrayList<String> names = messageContainer.getNames();
		ArrayList<String> messages = messageContainer.getMessages();
		int messageCount = messageContainer.getMessages().size();
		String combinedMessages = "";
		for (int i = 0; i < messageCount; i++) {
			combinedMessages = "<b>"+names.get(i) + "</b>:<br/>" + messages.get(i)
					+ "<br/><br/>" + combinedMessages;
		}
		out.println(combinedMessages);
	%>
</body>
</html>